<?php

namespace app\common\validate;

use think\Validate;

class Member extends Validate
{
    protected $rule = [
        'cellphone' => ['require', 'regex' => '/^0?1[3|4|5|6|7|8|9][0-9]\d{8}$/'],
        'oldpassword' => 'require|length:6,32',
        'password' => 'require|length:6,32',
        'qq' => 'require|number|length:4,15',
        'repassword' => 'require|confirm:password',
        'up1_userid' => 'require',
    ];

    protected $message = [
        'cellphone.require' => '手机号必填',
        'cellphone.regex' => '手机号码格式不正确',
        'qq.require' => '请填写qq',
        'qq.number' => '请不要乱填写qq',
        'qq.length' => '请不要乱填写qq',
        'up1_userid' => '请填写邀请码'
    ];

    protected $scene = [
        'login' => ['cellphone', 'password'],
        'register' => ['cellphone', 'password', 'repassword', 'up1_userid', 'qq'],
        'password_find' => ['cellphone', 'password', 'repassword'],
        'edit_pwd' => ['oldpassword', 'password', 'repassword'],
    ];
}
